﻿@model IEnumerable<LibYanu.Security.DTO.AspnetRoleDto>

@{
    ViewBag.Title = "ListRole";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<script type="text/javascript">
    $(function () {
        $('#UpdateName').click(function () {
            $.ajax({
                type: 'POST',
                contentType: 'application/json; charset=utf-8',
                data: '{"RoleId":"00000000-0000-0000-0000-000000000000","RoleName":"Office Boy","LoweredRoleName":"office boy","Description":null,"AspnetApplication":null,"AspnetUsers":null}',
                dataType: 'html',
                url: '@Url.Action("getstring")',
                success: function (result) {
                    var ctx = JSON.parse(result);
                    $('#Response').html(ctx.RoleName);
                }
            });
        });
    }); 
</script>
<h2>ListRole</h2>   

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th>
            RoleId
        </th>
        <th>
            RoleName
        </th>
        <th>
            LoweredRoleName
        </th>
        <th>
            Description
        </th>
        <th></th>
    </tr>
    @if(Model!=null)
    {
        foreach (var item in Model)
        {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.RoleId)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.RoleName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.LoweredRoleName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Description)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new {  id=item.RoleId }) |
            @Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
            @Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
        </td>
    </tr>
        }
}

</table>
<button type="button" id="UpdateName">Update</button> 
<p><span id="Response"></span></p>
